import { userStore } from '@/stores/user.ts'

export const registerPermission = (app: any) => {
  app.directive('auth', {
    mounted(el: any, binding: any) {
      const user = userStore()
      if (!user.hasPerms(binding.value)) {
        el.parentNode.removeChild(el)
      }
    }
  })
}